package zeebe.gateway.Parallel;

import io.vertx.core.json.JsonObject;
import io.zeebe.client.ZeebeClient;
import io.zeebe.client.api.response.ActivatedJob;
import io.zeebe.client.api.worker.JobClient;
import io.zeebe.client.api.worker.JobHandler;

public class CJobWorkerHandler implements JobHandler {
    ZeebeClient zeebeClient;

    public CJobWorkerHandler(ZeebeClient client) {
        this.zeebeClient = client;
    }

    @Override
    public void handle(JobClient client, ActivatedJob job) throws Exception {
        System.out.println("开始执行CJobWorker");
        JsonObject data=new JsonObject(job.getVariables());
        int a=data.getInteger("A");
        int b=data.getInteger("B");
        int c=a+b;
        System.out.println("执行CService：A+B的值："+c);

        client.newCompleteCommand(job.getKey())
                .send()
                .join();
    }
}
